/*
 * Exploder
 * 
 * Tero Pyylampi (218437), Jussi Tuurinkoski (211594)
 *
 * A single button for interface which is used to create a physics object (either an element or a bomb)
 */

#ifndef GAMEINTERFACEPHYSICOBJECTBUTTON_H
#define GAMEINTERFACEPHYSICOBJECTBUTTON_H

#include "GameInterfaceObject.h"
#include "../../Common.h"
#include "Box2D/Box2D.h"
#include "cocos2d.h"

class GameInterfaceItemAndObjectContainer;
class GameCamera;

class GameInterfacePhysicObjectButton : public GameInterfaceObject {
public:
	// default constructor
	GameInterfacePhysicObjectButton( cocos2d::CCLayer *layer, GameInterfaceItemAndObjectContainer *master, PhysicObjectItems type, cocos2d::CCPoint buttonPos, int moneyValue = 0 );
	// default destructor
	virtual ~GameInterfacePhysicObjectButton();

	// update function of the object
	virtual void update( cocos2d::ccTime dt );

	// function for checking whether the given coordinates are inside the background sprite (button)
	bool testIfCoordinatesAreInsideBackgroundSprite( cocos2d::CCPoint screenCoords );
	// returns the price of this object
	int getObjectPrice();

	// function for initializing the item connected to this button, should return the physics object created
	b2Body *createAndInitializeNewCorrespondingItem( GameCamera *camera, b2Vec2 position );

protected:
	// pointer to the master container
	GameInterfaceItemAndObjectContainer *mMaster;

	// my own type
	PhysicObjectItems mItemType;
	// my position
	cocos2d::CCPoint mPosition;

	// background sprite
	cocos2d::CCSprite *mBackgroundSprite;
	// item indicator sprite
	cocos2d::CCSprite *mItemIndicatorSprite;

	// money label
	cocos2d::CCLabelBMFont *mMoneyLabel;
	int mMoney;
};

#endif